<!-- 案例列表 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label">案例列表</p>
        <div class="mt10" v-if="ishjwoer">
            <dxtable :headBtn="headBtn"   :extra="extra" imgkuTitle="案例封面" :dataJson="dataJson"  :formJson="formJson" :portUrl="portUrl" :qx="qx" ref="databale"></dxtable>
        </div>
    </div>
</template>
<script lang='ts' setup>
import dxtable from "./../../components/util/dxtable.vue";
import sort from "./../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf } from "./../../util/index";
import { h, ref, reactive } from "vue";
const props = defineProps({
    pup: { type: String },
});
const ishjwoer  = ref(false)
let headBtn = [];
const databale = ref();
const initeer = () => {
    databale.value.initDataExpose();
};
const typeli = ref([])
const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
    {
        title: "案例名称",
        key: "name",
        search: true, // 是否在搜索栏展示
    },
    {
        title: "简介",
        key: "synopsis",
        search: true, // 是否在搜索栏展示
    },

    {
        title: "排序",
        width: 100,
        render(row) {
            row.databaseName = "dxcase";
            return h(sort, {
                row,
                onCallBack: () => {
                    initeer();
                },
            });
        },
    },
    

    
    {
        title: "添加时间",
        key: "addTime",
        width: "200",
        type: "daterange",
    },
]);
let portUrl = "tutucloud/dxcasewb?roleId="+localStorage.id;
const extra = ref({
    roleId: localStorage.id
});
const qx = {
    DeletePermissionID: "tutucasedel", //删除
    EditPermissionIdentifier: "tutucasebj", // 编辑
    NewPermissionIdentifier: "tutucasexz", // 新建
    ViewPermissionID: "tutucaseck", // 查看
};


let formJson = ref([
  {
        title: "案例名称",
        key: "name",
        type: "input",
        span:24,
        required: true, // 是否为必填
    },
    
    {
        title: "封面",
        key: "cover",
        type: "img",
        required: true, // 是否为必填
    }, {
        title: "图标",
        key: "icon",
        type: "img",
        required: true, // 是否为必填
    }, 
    {
        title: "简介",
        type:"textarea",
        key: "synopsis",
        required: true, // 是否为必填
    }, 
    {
        title: "详情",
        key: "introduce",
        type:"textarea",
        required: true, // 是否为必填
    },
   

])


const getcasetype = async ()=>{
  const {data}:any =  await dxget("dxgjAdmin/getzd",{name:'casetype'})
  formJson.value[1].options = data
  dataJson[2].options = [
    {
        label:"全部",
        value:""
    },
    ...data
  ]
  typeli.value = data
  ishjwoer.value = true
}
getcasetype()

</script>
  
  
  